package cate.game.server.controller;

import cate.game.server.service.RobotService;
import cp.solution.business.robot.cmd.RobotCreateResult;
import easy.java.spring.annotation.MyGetMapping;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Slf4j
@RequestMapping("robot")
@Controller
public class RobotController extends GameSrvBaseController {

    @Resource
    RobotService service;

    @MyGetMapping("create")
    @ResponseBody
    public RobotCreateResult create(@RequestParam int srvId, @RequestParam int mode, @RequestParam String token) {
        log.info("收到创建机器人的请求：srvId={} mode={} token={}", srvId, mode, token);
        return service.create(srvId, mode, token);
    }

    @MyGetMapping("delete")
    @ResponseBody
    public int delete(@RequestParam int srvId, @RequestParam String roleId) {
        log.info("收到删除机器人的请求：srvId={} roleId={} ", srvId, roleId);
        return service.delete(srvId, roleId);
    }
}